package net.wanho.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import net.wanho.po.Emp;
import net.wanho.service.EmpService;
import net.wanho.vo.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 员工表 前端控制器
 * </p>
 *
 * @author 
 * @since 2024-12-20
 */
@RestController
@RequestMapping("/emp")
public class EmpController {

    @Autowired
    private EmpService empService;

    @GetMapping
    public AjaxResult findAll(){
        List<Emp> list =  empService.selectAll();
        return AjaxResult.success(list);
    }

    @GetMapping("/page")
    public AjaxResult findByPage(int pageNum, int pageSize, Emp emp){
        Page<Emp> page = empService.findByPage(pageNum, pageSize, emp);
        return AjaxResult.success(page);
    }
}
